<template>
    <input @keydown.enter="add" type="text" placeholder="添加ToDo" />
</template>
<script>
export default {
    setup(props, context) {
        let add = function (e) {
            context.emit('add', e.target.value)
            e.target.value = ''
        }
        return {
            add
        }
    }
}
</script>